﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Block : MonoBehaviour {
    public GameObject blockImg;
    public GameObject countTextGO;
    int count;

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}

    public void setNum(int num) {
        count = num;
        countTextGO.GetComponent<Text>().text = "" + count;

        float r, g, b;
        r = ((num % 10) / 9.0f);
        g = (((num/10)% 10) / 9.0f);
        b = (((num / 100) % 10) / 9.0f);
        blockImg.GetComponent<Image>().color = new Color(r,g,b);
    }
}
